<template>
  <div class="cashMode"> 
    <div class="tabs-box">
      <div class="tabs" v-show="alipayShow" >
        <div @click="backUp('alipay')" >
          <van-radio>
            <img
              src="../../assets/images/48.png"
              alt=""
            >
            <span>支付宝</span>
          </van-radio>

        </div>
        <div @click="goCashInfo('alipay')" ><i class="icon iconfont icon-xiangyou"></i></div>
      </div>

      <div class="tabs" v-show="weixinShow"  >
        <div @click="backUp('weixin')" >
          <van-radio>
          <img
            src="../../assets/images/103.png"
            alt=""
          >
          <span>微信</span>
          </van-radio>
        </div>
        <div @click="goCashInfo('weixin')"><i class="icon iconfont icon-xiangyou"></i></div>
      </div>
 
      <div class="tabs"  @click="goCashAdd('alipay')" v-show="chooseShowAlipay">
        <div>
          <img
            src="../../assets/images/500.png"
            alt=""
          >
          <span class="title">添加支付宝提现信息</span>
        </div> 
      </div>

      <div class="tabs"  @click="goCashAdd('weixin')" v-show="chooseShowWechat">
        <div>
          <img
            src="../../assets/images/500.png"
            alt=""
          >
          <span class="title">添加微信提现信息</span>
        </div>
      </div>

    </div>
  </div>
</template>
<script>
import myHeader from "../header/index.vue";
import { getUserInfo } from "../../api/user";

export default {
  data() {
    return {
      radio: '1',
      ifAlipay:0,
      ifWechat:0,
      alipayShow:false,
      weixinShow:false,
      chooseShowAlipay:true,
      chooseShowWechat:true,
    };
  },
  methods: {
      backUp(type){
        this.$router.push({
          path: "/cash?choose="+type
        });
      },
      goCashAdd(type) {
        this.$router.push({
          path: "/cashAdd",
          query: {
            type: type,
          }
        });
      },
      goCashInfo(type){
        this.$router.push({
          path: "/cashInfo",
          query: {
            type: type,
          }
        });
      },
      getUserAccount(){
        getUserInfo().then(res => {
          this.ifAlipay = res.data.info.alipay
          this.ifWechat = res.data.info.wechat

          if(this.ifAlipay==1){
            this.alipayShow = true
            this.chooseShowAlipay = false
          }
          if(this.ifWechat==1){
            this.weixinShow = true
            this.chooseShowWechat= false
          }
        });
      },
  },
  created(){
    this.getUserAccount();
  }
};
</script>

<style lang="scss">
.cashMode {
  width: 100%;
  overflow-x: hidden; 
  background-color: #f5f5f5;
  padding-bottom: 48px;
  .tabs-box {
    width: 100%;
    margin-top: 10px;
    .tabs {
      margin-bottom: 10px;
      width: 100%;
      height: 48px;
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      padding: 0 15px;
      background-color: #fff;
      border-bottom: 1px solid #eee;
      img {
        vertical-align: middle;
        width: 20px;
      }
    .title{
          color:#888;
          font-size:14px;  
      }
      span {
        vertical-align: middle;
        padding-left: 10px;
        font-size: 14px;
      }
    }
  }
}
</style>


